//SimpleFactory.java
package simpleFactory;

/**
 *simple factory pattern.
 *@author: youtubezou
 *@version:2012-7-6
 *
 */
public class SimpleFactory {
	//for test simple factory pattern
	public static void main (String[] args) {
		Product product = SimpleFactory.factory("ConcreteProduct");
		System.out.println(product);
		product = SimpleFactory.factory();
		System.out.println(product);
	}
	
	/*multiple factory methods*/
	public static Product factory() {
		return new ConcreteProduct("Product>>SimpleFactory.factory()");
	}

	public static Product factory(String productName) {
		if ("ConcreteProduct".equalsIgnoreCase(productName))
			return new ConcreteProduct("Product>>SimpleFactory.factory(String productName)");
		//.......
		return null;
	}
	
	
}
